/**
 * 
 */
package com.eascs.admin.item.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.eascs.admin.item.dao.O2oPubDdItemDao;

/**@Description:
 *               <p>
 *               
 *               </p>
 * @author LMX
 * @date 2017年10月11日 下午2:48:12
 * @version V1.0
 */
@Service
public class O2oPubDdItemServiceImpl implements IO2oPubDdItemService{
	@Autowired
	O2oPubDdItemDao ddItemDao;
	
	/**
	 * @Description:
	 *               <p>
	 *               查询贷款类型数据字典,只筛选出蔬果贷、烟草贷、商超贷
	 *               </p>
	 * @author LMX
	 * @date 2017年10月11日 上午10:36:14
	 * @version V1.0
	 * @param vo
	 * @return
	 */
	public List<Object[]> findPubDd() {
		List<Object[]> dataSouceList = new ArrayList<>();
		List<Object> listParams = new ArrayList<Object>();
		StringBuffer querySql = new StringBuffer();
		querySql.append(" SELECT DISTINCT m.item_code,m.item_name FROM pub_dditem m  ");
		querySql.append(" LEFT JOIN pub_datadictionary d ON m.dd_no=d.dd_no ");
		querySql.append(" WHERE 1=1 AND m.is_lock = 'N' AND d.is_lock = 'N' ");
		querySql.append(" AND d.dd_code = 'OTO_LOAN_TYPE' ");	// #贷款类型OTO_LOAN_TYPE
		querySql.append(" AND m.item_code IN('SG','YC','SC') ");// #只筛选出蔬果贷、烟草贷、商超贷
//		querySql.append(" AND m.item_code NOT IN('EA','FQ') ");	// #排除:接力贷、分期贷
		querySql.append(" ORDER BY m.item_order ASC ");
		dataSouceList = ddItemDao.findObjectsList(querySql.toString(), listParams.toArray());
		return dataSouceList;
	}
	
	/**
	 * @Description:
	 *               <p>
	 *               查询贷款类型数据字典,所有
	 *               </p>
	 * @author LMX
	 * @date 2017年10月11日 上午10:36:14
	 * @version V1.0
	 * @param vo
	 * @return
	 */
	public List<Object[]> findPubDdAll() {
		List<Object[]> dataSouceList = new ArrayList<>();
		List<Object> listParams = new ArrayList<Object>();
		StringBuffer querySql = new StringBuffer();
		querySql.append(" SELECT DISTINCT m.item_code,m.item_name FROM pub_dditem m  ");
		querySql.append(" LEFT JOIN pub_datadictionary d ON m.dd_no=d.dd_no ");
		querySql.append(" WHERE 1=1 AND m.is_lock = 'N' AND d.is_lock = 'N' ");
		querySql.append(" AND d.dd_code = 'OTO_LOAN_TYPE' ");	// #贷款类型OTO_LOAN_TYPE
//		querySql.append(" AND m.item_code IN('SG','YC','SC') ");// #只筛选出蔬果贷、烟草贷、商超贷
//		querySql.append(" AND m.item_code NOT IN('EA','FQ') ");	// #排除:接力贷、分期贷
		querySql.append(" ORDER BY m.item_order ASC ");
		dataSouceList = ddItemDao.findObjectsList(querySql.toString(), listParams.toArray());
		return dataSouceList;
	}
}
